/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package uk.ac.liv;

import java.util.ArrayList;
import java.util.Arrays;

/**
 *
 * @author Da Qi
 * @institute University of Liverpool
 * @time 20-Mar-2013 15:19:59
 */
public enum ModificationElement {

    Acetyl_K("Acetyl (K)", new String[]{"K"}, 42.010565),
    Acetyl_Nterm("Acetyl (N-term)", new String[]{"["}, 42.010565),
    Acetyl_ProteinNterm("Acetyl (Protein N-term)", new String[]{"ProtNTERM"}, 42.010565),
    Amidated_Cterm("Amidated (C-term)", new String[]{"]"}, -0.984016),
    Amidated_ProteinCterm("Amidated (Protein C-term)", new String[]{"ProtCTERM"}, -0.984016),
    //AmmoniaLoss_NtermC("Ammonia-loss (N-term C)", new String[]{"[", "C"}, -17.026549),
    Biotin_K("Biotin (K)", new String[]{"K"}, 226.077598),
    Biotin_Nterm("Biotin (N-term)", new String[]{"["}, 226.077598),
    Carbamidomethyl_C("Carbamidomethyl (C)", new String[]{"C"}, 57.021464),
    Carbamyl_K("Carbamyl (K)", new String[]{"K"}, 43.005814),
    Carbamyl_Nterm("Carbamyl (N-term)", new String[]{"["}, 43.005814),
    Carboxymethyl_C("Carboxymethyl (C)", new String[]{"C"}, 58.005479),
    CationNa_Cterm("Cation:Na (C-term)", new String[]{"]"}, 21.981943),
    CationNa_DE("Cation:Na (DE)", new String[]{"D", "E"}, 21.981943),
    cysTMT6plex_C("cysTMT6plex (C)", new String[]{"C"}, 304.177202),
    Deamidated_NQ("Deamidated (NQ)", new String[]{"N", "Q"}, 0.984016),
    //Dehydrated_NtermC("Dehydrated (N-term C)", new String[]{"[", "C"}, -18.010565),
    Dehydro_C("Dehydro (C)", new String[]{"C"}, -1.007825),
    DiLeu4plex_K("DiLeu4plex (K)", new String[]{"K"}, 145.132163),
    DiLeu4plex_Nterm("DiLeu4plex (N-term)", new String[]{"["}, 145.132163),
    DiLeu4plex_Y("DiLeu4plex (Y)", new String[]{"Y"}, 145.132163),
    Dioxidation_M("Dioxidation (M)", new String[]{"M"}, 31.989829),
    Ethanolyl_C("Ethanolyl (C)", new String[]{"C"}, 44.026215),
    ExacTagAmine_K("ExacTagAmine (K)", new String[]{"K"}, 1046.347854),
    ExacTagThiol_C("ExacTagThiol (C)", new String[]{"C"}, 972.365219),
    Formyl_Nterm("Formyl (N-term)", new String[]{"["}, 27.994915),
    Formyl_ProteinNterm("Formyl (Protein N-term)", new String[]{"ProtNTERM"}, 27.994915),
    //GlnPyroGlu_NtermQ("Gln->pyro-Glu (N-term Q)", new String[]{"[", "Q"}, -17.026549),
    //GluPyroGlu_NtermE("Glu->pyro-Glu (N-term E)", new String[]{"[", "E"}, -18.010565),
    Guanidinyl_K("Guanidinyl (K)", new String[]{"K"}, 42.021798),
    ICATC_C("ICAT-C (C)", new String[]{"C"}, 227.126991),
    ICATC13C9_C("ICAT-C:13C(9) (C)", new String[]{"C"}, 236.157185),
    ICPL_K("ICPL (K)", new String[]{"K"}, 105.021464),
    ICPL_ProteinNterm("ICPL (Protein N-term)", new String[]{"ProtNTERM"}, 105.021464),
    ICPL13C6_K("ICPL:13C(6) (K)", new String[]{"K"}, 111.041593),
    ICPL13C6_ProteinNterm("ICPL:13C(6) (Protein N-term)", new String[]{"ProtNTERM"}, 111.041593),
    ICPL13C62H4_K("ICPL:13C(6)2H(4) (K)", new String[]{"K"}, 115.066700),
    ICPL13C62H4_Nterm("ICPL:13C(6)2H(4) (N-term)", new String[]{"["}, 115.066700),
    ICPL13C62H4_ProteinNterm("ICPL:13C(6)2H(4) (Protein N-term)", new String[]{"ProtNTERM"}, 115.066700),
    ICPL2H4_K("ICPL:2H(4) (K)", new String[]{"K"}, 109.046571),
    ICPL2H4_ProteinNterm("ICPL:2H(4) (Protein N-term)", new String[]{"ProtNTERM"}, 109.046571),
    iTRAQ4plex_K("iTRAQ4plex (K)", new String[]{"K"}, 144.102063),
    iTRAQ4plex_Nterm("iTRAQ4plex (N-term)", new String[]{"["}, 144.102063),
    iTRAQ4plex_Y("iTRAQ4plex (Y)", new String[]{"Y"}, 144.102063),
    iTRAQ8plex_K("iTRAQ8plex (K)", new String[]{"K"}, 304.205360),
    iTRAQ8plex_Nterm("iTRAQ8plex (N-term)", new String[]{"["}, 304.205360),
    iTRAQ8plex_Y("iTRAQ8plex (Y)", new String[]{"Y"}, 304.205360),
    Label18O1_Cterm("Label:18O(1) (C-term)", new String[]{"]"}, 2.004246),
    Label18O2_Cterm("Label:18O(2) (C-term)", new String[]{"]"}, 4.008491),
    //MetHse_CtermM("Met->Hse (C-term M)", new String[]{"]", "M"}, -29.992806),
    //MetHsl_CtermM("Met->Hsl (C-term M)", new String[]{"]", "M"}, -48.003371),
    Methyl_Cterm("Methyl (C-term)", new String[]{"]"}, 14.015650),
    Methyl_DE("Methyl (DE)", new String[]{"D", "E"}, 14.015650),
    Methylthio_C("Methylthio (C)", new String[]{"C"}, 45.987721),
    mTRAQ_K("mTRAQ (K)", new String[]{"K"}, 140.094963),
    mTRAQ_Nterm("mTRAQ (N-term)", new String[]{"["}, 140.094963),
    mTRAQ_Y("mTRAQ (Y)", new String[]{"Y"}, 140.094963),
    mTRAQ13C315N1_K("mTRAQ:13C(3)15N(1) (K)", new String[]{"K"}, 144.102063),
    mTRAQ13C315N1_Nterm("mTRAQ:13C(3)15N(1) (N-term)", new String[]{"["}, 144.102063),
    mTRAQ13C315N1_Y("mTRAQ:13C(3)15N(1) (Y)", new String[]{"Y"}, 144.102063),
    mTRAQ13C615N2_K("mTRAQ:13C(6)15N(2) (K)", new String[]{"K"}, 148.109162),
    mTRAQ13C615N2_Nterm("mTRAQ:13C(6)15N(2) (N-term)", new String[]{"["}, 148.109162),
    mTRAQ13C615N2_Y("mTRAQ:13C(6)15N(2) (Y)", new String[]{"Y"}, 148.109162),
    NIPCAM_C("NIPCAM (C)", new String[]{"C"}, 99.068414),
    Oxidation_HW("Oxidation (HW)", new String[]{"H", "W"}, 15.994915),
    Oxidation_M("Oxidation (M)", new String[]{"M"}, 15.994915),
    Phospho_ST("Phospho (ST)", new String[]{"S", "T"}, 79.966331),
    Phospho_Y("Phospho (Y)", new String[]{"Y"}, 79.966331),
    Propionamide_C("Propionamide (C)", new String[]{"C"}, 71.037114),
    Pyridylethyl_C("Pyridylethyl (C)", new String[]{"C"}, 105.057849),
    //PyroCarbamidomethyl_NtermC("Pyro-carbamidomethyl (N-term C)", new String[]{"[", "C"}, 39.994915),
    Sulfo_STY("Sulfo (STY)", new String[]{"S", "T", "Y"}, 79.956815),
    TMT2plex_K("TMT2plex (K)", new String[]{"K"}, 225.155833),
    TMT2plex_Nterm("TMT2plex (N-term)", new String[]{"["}, 225.155833),
    TMT6plex_K("TMT6plex (K)", new String[]{"K"}, 229.162932),
    TMT6plex_Nterm("TMT6plex (N-term)", new String[]{"["}, 229.162932),
    //no selection
    NoSelecton("--- none selected ---", new String[]{"NONE"}, 0.00);
//
    private String modName;
    private String[] modPositions;
    private Double massShift;

    private ModificationElement(String modName, String[] modPositions,
                                Double massShift) {
        this.modName = modName;
        this.modPositions = modPositions;
        this.massShift = massShift;
    }

    public String getModName() {
        return modName;
    }

    public String[] getModPositions() {
        return modPositions;
    }

    public Double getMassShift() {
        return massShift;
    }

    public static Double getMassShift(String modName) {
        for (ModificationElement modEl : ModificationElement.values()) {
            if (modEl.getModName().equals(modName)) {
                return modEl.getMassShift();
            }
        }
        return null;
    }

    public static String[] getModPositions(String modName) {
        for (ModificationElement modEl : ModificationElement.values()) {
            if (modEl.getModName().equals(modName)) {
                return modEl.getModPositions();
            }
        }
        return null;
    }

    public static ModificationElement getModificationElement(String modName) {
        for (ModificationElement modEl : ModificationElement.values()) {
            if (modEl.getModName().equals(modName)) {
                return modEl;
            }
        }
        return null;
    }

    @Override
    public String toString() {
        return "\""
                + modName + "\"@"
                + Arrays.asList(modPositions).toString() + "--"
                + massShift;

    }

}
